home *** CD-ROM | disk | FTP | other *** search
- /*
- $VER: AutoDoc.rexx V0.98 (8.3.94) © Axel Burghardt
-
- Dieses ARexx-Skript extrahiert aus <Dateiname> die AutoDoc-Einträge.
- Diese können über '>' in eine Datei umgeleitet werden.
-
- Im Modus 'AUTODOC' arbeitet das Skript wie AutoDoc V1.0 (siehe NDUK-Paket)
- in den Optionen -C -I. Die Zeilen werden nach dem 77.Zeichen umgebrochen!
-
- Wird Modus nicht angegeben, werden die AutoDoc-Einträge in ihrem Kontext
- (Quelltetx) belassen. So lassen sich (dokumentierte) C-Quelltexte in die
- Hypertext-Struktur pressen und mittels AmigaGuide/Multiview betrachten.
- */
-
- PARSE ARG File Mode .
-
- Format = "AutoDoc <Dateiname> [AUTODOC]"
- TRUE = 1
- FALSE = 0
- Module = FALSE
- CR = '0a'x /* Wagenrücklauf */
- LF = '0c'x /* Zeilenvorschub */
- Toc = "TABLE OF CONTENTS" || CR /* Table Of Contents */
- Doc = "T:Autodoc.doc"
- Table = "T:Autodoc.table"
-
- /* ------------------ Support-Bibliothek öffnen ------------------- */
-
- IF ~show('L','rexxsupport.library') THEN
- IF ~addlib('rexxsupport.library',0,-30,0) THEN DO
- say "Kann 'rexxsupport.library' nicht öffnen!"
- EXIT 20
- END
-
- /* ----------------------- Datei vorhanden? ----------------------- */
-
- IF File = '' | ~exists(File) THEN DO
- say "Datei" upper(File) "nicht gefunden!"
- EXIT 20
- END
-
- /* ------------------------ Welcher Modus? ------------------------ */
-
- IF Mode ~= '' & Mode ~='AUTODOC' THEN DO
- say Format
- EXIT 20
- END
-
- /* -------------------------- Hauptteil --------------------------- */
-
- IF open(Input,File,'R') THEN DO
- IF ~open('OutDoc',Doc,'W') | ~open('OutTable',Table,'W') THEN
- EXIT 20
-
- DO WHILE ~eof(Input)
- Line = readln(Input)
- IF Module = FALSE THEN DO
- PARSE VAR Line First '/****** ' Head Last
- IF First = '' & Head ~= '' THEN DO
- Spaces = 77 - 2 * length(Head)
- IF Mode = 'AUTODOC'THEN DO
- Module = TRUE
- Header = Head || copies(' ',Spaces) || Head
- END
- ELSE
- Header = LF || Head || copies(' ',Spaces) || Head || CR || Line
- writeln('OutTable',Head)
- writeln('OutDoc',Header)
- END
- ELSE
- IF Mode ~= 'AUTODOC' THEN writeln('OutDoc',Line)
- END
- ELSE DO /* Modul = TRUE */
- PARSE VAR Line First '***' Last
- IF First = '' & Last ~= '' THEN DO
- Module = FALSE
- writeln('OutDoc',LF)
- END
- ELSE DO
- IF left(Line,1) = "*" THEN Line = delstr(Line,1,1)
- IF length(Line) > 77 THEN Line = insert(CR,Line,77)
- writeln('OutDoc',Line)
- END
- END
- END /* while */
- close('OutDoc')
- close('OutTable')
-
- /* -------------------- Dateien zusammenbauen --------------------- */
-
- parse value statef(Table) with Type Size .
-
- IF Size > 0 THEN DO
- address command 'sort' Table Table'.sorted' /* <Table>.sorted */
- open('OutTable',Table||'.sorted')
- say "TABLE OF CONTENTS"
- say
- DO WHILE ~eof('OutTable')
- say readln('OutTable')
- END
- say LF
- close('OutTable')
- open('OutDoc',Doc,'R')
- DO while ~eof('OutDoc')
- say readln('OutDoc')
- END
- delete(Table'.sorted')
- END
- delete(Doc)
- delete(Table)
- EXIT 0
- END
- ELSE
- EXIT 20
-